// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.iso;

import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import zombie.core.opengl.Shader;
import zombie.core.opengl.ShaderProgram;
import zombie.core.textures.TextureDraw;

public class FireShader extends Shader {
    private int mvpMatrix;
    private int FireTime;
    private int FireParam;
    private int FireTexture;

    public FireShader(String name) {
        super(name);
    }

    @Override
    protected void onCompileSuccess(ShaderProgram shaderProgram) {
        int _int = shaderProgram.getShaderID();
        this.FireTexture = ARBShaderObjects.glGetUniformLocationARB(_int, "FireTexture");
        this.mvpMatrix = ARBShaderObjects.glGetUniformLocationARB(_int, "mvpMatrix");
        this.FireTime = ARBShaderObjects.glGetUniformLocationARB(_int, "FireTime");
        this.FireParam = ARBShaderObjects.glGetUniformLocationARB(_int, "FireParam");
        this.Start();
        if (this.FireTexture != -1) {
            ARBShaderObjects.glUniform1iARB(this.FireTexture, 0);
        }

        this.End();
    }

    public void updateFireParams(TextureDraw texd, int userId, float in_firetime) {
        ParticlesFire particlesFire = ParticlesFire.getInstance();
        GL13.glActiveTexture(33984);
        particlesFire.getFireFlameTexture().bind();
        GL11.glTexEnvi(8960, 8704, 7681);
        ARBShaderObjects.glUniformMatrix4fvARB(this.mvpMatrix, true, particlesFire.getMVPMatrix());
        ARBShaderObjects.glUniform1fARB(this.FireTime, in_firetime);
        ARBShaderObjects.glUniformMatrix3fvARB(this.FireParam, true, particlesFire.getParametersFire());
        if (this.FireTexture != -1) {
            ARBShaderObjects.glUniform1iARB(this.FireTexture, 0);
        }
    }
}
